#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string.h>

using namespace std;

int main()
{

	int cflag = 0;
	int count = 0;
	int chnum = 0;

	while (1)
	{
		count++;

		char str[66] = { 0 };
		scanf("%[^\n]s", str);
		getchar();

		if (str[0] == '.')
		{
			break;
		}

		int len = strlen(str);
		char* pf = str;
		char* pl = str;
		for (int i = 0; i < len; i++)
		{

			if (str[i] == 'c' && str[i + 1] == 'h' && str[i + 2] == 'i')
			{
				pf = str + i;
				cflag = 1;
			}

			if (cflag == 1 && str[i] == '1' &&str[i-1] == 'o')
			{
				pl = str + i;
			}

		}

		int plen = pl - pf;
		char new_str[66] = { 0 };
		for (int i = 0; i <= plen; i++, pf++)
		{
			new_str[i] = *pf;
		}
		new_str[plen + 1] = '\0';

		if (strcmp(new_str, "chi1 huo3 guo1") == 0)
		{

			if (chnum == 0)
			{
				printf("first = %d\n", count);
			}
			chnum++;

		}
	}

	printf("words = %d\n", count - 1);
	if (chnum != 0)
	{
		printf("chi huo guo = %d\n", chnum);
	}
	else
	{
		printf("-_-#\n");
	}
	
	return 0;
}
